Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More

troika-three-text

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

troika-three-text

SDF-based text rendering for Three.js


Version published
Maintainers
1
Created

What is troika-three-text?

The troika-three-text npm package is a library for rendering high-quality, performant text in Three.js scenes. It provides a simple and flexible way to add 3D text to your WebGL applications, with support for advanced features like custom fonts, text layout, and text effects.

What are troika-three-text's main functionalities?

Basic Text Rendering

This feature allows you to render basic 3D text in a Three.js scene. You can set the text content, font size, and position.

const { Text } = require('troika-three-text');
const text = new Text();
text.text = 'Hello, World!';
text.fontSize = 1;
text.position.set(0, 0, 0);
scene.add(text);

Custom Fonts

This feature allows you to use custom fonts by specifying the URL to a font file. This can be useful for branding or stylistic purposes.

const { Text } = require('troika-three-text');
const text = new Text();
text.text = 'Custom Font';
text.font = 'https://example.com/path/to/font.woff';
text.fontSize = 1;
text.position.set(0, 0, 0);
scene.add(text);

Text Effects

This feature allows you to apply various effects to the text, such as changing the color or adding glow effects. This can enhance the visual appeal of the text in your scene.

const { Text } = require('troika-three-text');
const text = new Text();
text.text = 'Glowing Text';
text.fontSize = 1;
text.position.set(0, 0, 0);
text.material = new THREE.MeshBasicMaterial({ color: 0xff0000 });
scene.add(text);

Other packages similar to troika-three-text

FAQs

Package last updated on 30 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts